package com.spark.controller;

import com.spark.Service.TagService;
import com.spark.pojo.Msg;
import com.spark.pojo.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/tags")
public class TagController {

    @Autowired
    TagService tagService;

    @ResponseBody
    @RequestMapping("/{userId}")
    public Msg getDisTagByUser(@PathVariable("userId") String userId) {
        List<Tag> tags = tagService.selectTagsByUserId(userId);
        return Msg.success().addAttribute("tags", tags);
    }
}
